﻿using System;
using System.Collections.Generic;
using System.Text;
using DataAccess;
using System.Data;
using Entity;

namespace BusinessObject
{
    public class SubCategoriesBO
    {
        SubCategoriesDA scDA = new SubCategoriesDA();

        public DataSet getSubCategory()
        {
            DataSet dt = scDA.getSubCategories();
            return dt;
        }
        public DataSet getSubCategoryByCate(int id)
        {
            DataSet dt = scDA.getSubCategoriesByCate(id);
            return dt;
        }
        public bool createSubCategory(int cateId, string subCateName, string subCateImage, string subCateDes, float subCateArea, string subCateHuong)
        {
            SubCategory sc = new SubCategory();
            sc.Category_ID = cateId;
            sc.SubCategory_Name = subCateName;
            sc.SubCategory_Image = subCateImage;
            sc.SubCategory_Description = subCateDes;
            sc.SubCategory_Area = subCateArea;
            sc.SubCategory_Huong = subCateHuong;

            if (scDA.CreateSubCategories(sc))
            {
                return true;
            }
            return false;
        }

        public SubCategory selectSubCategoryByID(int id)
        {
            SubCategory sc = scDA.getSubCategoriesByID(id);
            return sc;
        }

        public bool updateSubCategory(SubCategory sc)
        {
            if (scDA.UpdateSubCategories(sc))
            {
                return true;
            }
            return false;
        }

        public bool removeSubCategory(SubCategory sc)
        {
            if (scDA.DeleteSubCategory(sc))
            {
                return true;
            }
            return false;
        }


    }
}
